home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / answrbok / 7_10.lha / 7_10 / p_rmlist.c < prev    next >
Text File  |  1993-08-08  |  1KB  |  36 lines

  1. * Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
  2. * The C++ Answer Book */
  3. * Tony Hansen */
  4. * All rights reserved. */
  5. include <process.h>
  6. include <debug.h>    /* DELETE */
  7. / Remove this process from a given list.
  8. / Return 0 if not found on the list.
  9. nt process::rmfromlist(process *srchprocess, process **stacklist)
  10.  
  11.    if (debug) {                        /*DELETE*/ 
  12. cerr << "process" << this << "::rmfromlist(" << srchprocess;/*DELETE*/
  13. if (stacklist == &t_runprocesses)            /*DELETE*/
  14.     { cerr << ", runprocesses)\n"; }            /*DELETE*/
  15. else if (stacklist == &t_waitprocesses)            /*DELETE*/
  16.     { cerr << ", waitprocesses)\n"; }            /*DELETE*/
  17. else if (stacklist == &t_doneprocesses)            /*DELETE*/
  18.     { cerr << ", doneprocesses)\n"; }            /*DELETE*/
  19. else                            /*DELETE*/
  20.     { cerr << ", unknown-list)\n"; }            /*DELETE*/
  21.    }                                /*DELETE*/
  22.    // search the list
  23.    for (process **pp = stacklist; *pp; pp = &(*pp)->t_next)
  24. if (*pp == srchprocess)
  25.     {
  26.     process *sv = *pp;
  27.     *pp = sv->t_next;
  28.     sv->t_next = 0;
  29.     if (debug) /*DELETE*/ cerr << "<<<< process" << this << "::rmfromlist(" << srchprocess << ") <- 1\n";
  30.     return 1;
  31.     }
  32.  
  33.    if (debug) /*DELETE*/ cerr << "<<<< process" << this << "::rmfromlist(" << srchprocess << ") <- 0\n";
  34.    return 0;
  35.  
  36.